package com.hengpeng.itfinoss.service.stm;

import java.util.Date;
import java.util.List;

import com.hengpeng.common.exception.ServiceResult;
import com.hengpeng.common.persist.query.model.Order.OrderType;
import com.hengpeng.itfinbase.persist.EmailLog;
import com.hengpeng.itfinbase.persist.EmailLog.EmailState;
import com.hengpeng.itfinbase.persist.EmailLog.EmailType;


/**
 * <pre>
 * TODO 邮件记录服务接口
 * </pre>
 * @author lanmingming
 * @version 1.0, 2011-9-7
 */
public interface EmailLogService {
	/**
	 * <pre>
	 *  新增邮件日志
	 * </pre>
	 * @param emailLog
	 * @return
	 */
	public ServiceResult<EmailLog> add(EmailLog emailLog);
	
	/**
	 * <pre>
	 *  更新邮件记录
	 * </pre>
	 * @param emailLog
	 * @return
	 */
	public ServiceResult<EmailLog> modify(EmailLog emailLog);
	
	/**
	 * <pre>
	 *  分页查询邮件记录
	 * </pre>
	 * @param emailType   	邮件类型(普通,通知,告警,促销,找回密码)
	 * @param userid 		操作员流水号
	 * @param storeId 		会员店流水号
	 * @param email  		邮箱
	 * @param title 		邮件标题
	 * @param content 		邮件内容
	 * @param state 		邮件状态(等待发送, 正在发送, 已发送)
	 * @param sendTime1 	邮件发送时间1
	 * @param sendTime2 	邮件发送时间2
	 * @param successTime1     邮件发送成功时间1
	 * @param successTime2     邮件发送成功时间2
	 * @param retryCount 	重复发送次数
	 * @param indexPage  	当前页号
	 * @param pageSize   	每页显示记录数
	 * @param order    		排序方式
	 * @param orderField	排序字段
	 * @return
	 */
	public ServiceResult<List<EmailLog>> selectEmailLogPage(EmailType emailType,String userid,String storeId,String email,
				String title,String content,EmailState state,Date sendTime1,Date sendTime2,
				Date successTime1,Date successTime2,Integer retryCount,int indexPage,int pageSize,OrderType order, String orderField);
	
	public ServiceResult<Long> selectCountEmailLogs(EmailType emailType,String userid,String storeId,String email,
				String title,String content,EmailState state,Date sendTime1,Date sendTime2,
				Date successTime1,Date successTime2,Integer retryCount);
	
	/**
	 * <pre>
	 *  查询出等待发送的邮件按照邮件级别排序  以便手工批量发送邮件
	 * </pre>
	 * @param ids 			ID数组
	 * @param state  		邮件发送状态
	 * @param order    		排序方式
	 * @param orderField	排序字段
	 * @return 响应信息
	 */
	public ServiceResult<List<EmailLog>> findNotsendEmailLogsOderByEmailLevel(Long[] ids,EmailState state,OrderType order, String orderField);

}
